//
//  ZGLNewsHeaderCollectionViewCell.m
//  ZeegingLottery
//
//  Created by 李曌 on 2018/11/8.
//  Copyright © 2018 蒂埃里. All rights reserved.
//

#import "ZGLNewsHeaderCollectionViewCell.h"

@interface ZGLNewsHeaderCollectionViewCell ()

@property (weak, nonatomic) IBOutlet UIImageView *homeIcon;
@property (weak, nonatomic) IBOutlet UILabel *homeName;
@property (weak, nonatomic) IBOutlet UILabel *homeScore;
@property (weak, nonatomic) IBOutlet UIImageView *awayIcon;
@property (weak, nonatomic) IBOutlet UILabel *awayName;
@property (weak, nonatomic) IBOutlet UILabel *awayScore;
@property (weak, nonatomic) IBOutlet UILabel *leagueName;
@property (weak, nonatomic) IBOutlet UILabel *matchTime;

@end

@implementation ZGLNewsHeaderCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self = [[NSBundle mainBundle] loadNibNamed:@"ZGLNewsHeaderCollectionViewCell" owner:self options:nil].lastObject;
        self.backgroundColor = [UIColor whiteColor];
        self.layer.cornerRadius = 5;
        self.layer.masksToBounds = YES;
        
    }
    return self;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    self.homeName.font = kFONT_SIZE(13);
    self.awayName.font = kFONT_SIZE(13);
    self.awayScore.font = kFONT_SIZE(13);
    self.homeScore.font = kFONT_SIZE(13);
    self.leagueName.font = kFONT_SIZE(13);
    self.matchTime.font = kFONT_SIZE(13);
    
}

- (void)setModel:(ZGLNewsBannerMatchModel *)model
{
    _model = model;
    NSString *imageHeader = @"http://betcat.zeeging.com";
    
    NSString *homeStr = [NSString stringWithFormat:@"%@%@",imageHeader,model.homelogo];
    NSURL *homeUrl = [NSURL URLWithString:homeStr];
    [self.homeIcon sd_setImageWithURL:homeUrl placeholderImage:[UIImage imageNamed:@"teamLogo_default"]];
    NSString *awayStr = [NSString stringWithFormat:@"%@%@",imageHeader,model.awaylogo];
    NSURL *awayUrl = [NSURL URLWithString:awayStr];
    [self.awayIcon sd_setImageWithURL:awayUrl placeholderImage:[UIImage imageNamed:@"teamLogo_default"]];
    
    self.homeName.text = model.homename;
    self.awayName.text = model.awayname;
    self.leagueName.text = model.leaguenameabbr;
    
    NSString *matchTime = [NSString stringWithFormat:@"%@ %@",model.matchdate,model.matchtime];
    self.matchTime.text = matchTime;
    
    if ([model.statustips isEqualToString:@"未开赛"]) {
        self.homeScore.text = @"-";
        self.awayScore.text = @"-";
    }else{
        
    }
    
    
}


@end
